/**
 * @author 小泽玛丽罗
 */


function forwardWeibo(){
	var content=$('#fcontent').val();
	//var osversion=getPlatform();
	
	var url='http://www.diaoyumi.ourstu.com/api/weibo/forward';
	//window.localStorage.setItem("ForwardContent",$('#content'));
	var httpID=122;
	uexXmlHttpMgr.onData = function(inOpCode, inStatus, inResult){
		if (inStatus == 1) {
			var json = eval("("+inResult+")");
			if (json["success"]) {
				uexWindow.closeToast();
				uexWindow.toast(1,5,"转发成功",500);
				uexWindow.open("weiboDetail", 0, "weiboDetail.html", 1, "", "", 0, 450);
				uexXmlHttpMgr.close(httpID);
			}else{
				uexWindow.toast(1,5,json["message"],500);
			}
		}
	}
	uexXmlHttpMgr.open(httpID,'post',url,3000);
	uexXmlHttpMgr.setPostData(httpID,'0','session_id',window.localStorage["session_id"]);
	uexXmlHttpMgr.setPostData(httpID,'0','weibo_id',window.localStorage["weiboDetail_id"]);
	uexXmlHttpMgr.setPostData(httpID,'0','device','iphone');
	uexXmlHttpMgr.setPostData(httpID,'0','content',content);
	if($$("isComment").checked){
		uexXmlHttpMgr.setPostData(httpID,'0','do_comment',true);
	}
	uexXmlHttpMgr.send(httpID);
	uexWindow.toast(1,5,"转发中....",0);
}
function commentWeibo(){
	var content=$('#comment').val();
	var url='http://www.diaoyumi.ourstu.com/api/weibo/comment';
	
	
	//window.localStorage.setItem("ForwardContent",$('#content'));
	var httpID=122;
	uexXmlHttpMgr.onData = function(inOpCode, inStatus, inResult){
		if (inStatus == 1) {
			var json = eval("("+inResult+")");
			if (json["success"]) {
				uexWindow.closeToast();
				uexWindow.toast(1,5,"评论成功",500);
				uexWindow.open("weiboDetail",0, "weiboDetail.html", 1, "", "", 0, 450);
				uexXmlHttpMgr.close(httpID);
			}
		}
	}
	uexXmlHttpMgr.open(httpID,'post',url,3000);
	uexXmlHttpMgr.setPostData(httpID,'0','session_id',window.localStorage["session_id"]);
	uexXmlHttpMgr.setPostData(httpID,'0','weibo_id',window.localStorage["weiboDetail_id"]);
	uexXmlHttpMgr.setPostData(httpID,'0','content',content);
	if($$("isForward").checked){
		uexXmlHttpMgr.setPostData(httpID,'0','do_forward',true); 
	}
	
	uexXmlHttpMgr.send(httpID);
	uexWindow.toast(1,5,"评论中....",0);
}

function collectWeibo(){
	var collectUrl='http://www.diaoyumi.ourstu.com/api/weibo/bookmark';
	var httpID=120;
	uexXmlHttpMgr.onData=function (inOpCode,inStatus,inResult){
		if(inStatus==1){
			var json = eval("("+inResult+")");
			if(json["success"]){
				uexWindow.toast(1,5,"收藏成功",1000);
				
				$('#star').removeClass("imgStar");
				$('#star').addClass("imgUnStar");
				uexXmlHttpMgr.close(httpID);
			}else{
				uexWindow.toast(1,5,json["message"],1000);
			}
		}
	};
	uexXmlHttpMgr.open(httpID,'post',collectUrl,3000);
	uexXmlHttpMgr.setPostData(httpID,'0','session_id',window.localStorage["session_id"]);
	uexXmlHttpMgr.setPostData(httpID,'0','weibo_id',window.localStorage["weiboDetail_id"]);
	uexXmlHttpMgr.send(httpID);

}
